<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>

<c:set var="ctx" value="${pageContext.request.contextPath}" />



<div class="container-fluid">
	<div class="tabbable" id="">
		<ul class="nav nav-tabs">
			<li class="active" id="all_coupon"><a href="#couponList" data-toggle="tab" id="AllCoupon" >所有优惠券</a>
			</li>
			<li id="money"><a href="#couponList" data-toggle="tab" id="money_coupon">现金券</a></li>
			<li id="goods"><a href="#couponList" data-toggle="tab" id="goods_coupon">实物券</a></li>	
            <li id="activity"><a href="#couponList" data-toggle="tab" id="activity_coupon">虚拟券</a></li>
            <li id="provided"><a href="#couponList" data-toggle="tab" id="provided_coupon">未使用</a></li>
            <li id="accepted"><a href="#couponList" data-toggle="tab" id="accepted_coupon">已使用</a></li>
            <li id="obsolete"><a href="#couponList" data-toggle="tab" id="obsolete_coupon">已作废</a></li>
            <li class = "pull-right" >
            	<div class="sort-box" >
					<select name="sort-select" id="project-select">
					<option name="project" id = "0">所有</option>
					</select>
				</div>
			</li>
		</ul>
		
		<!-- 优惠券列表容器 -->
		<div class="tab-content">
		<div class="tab-pane active" id="couponList" > </div>
		</div>
	</div>
</div>

<script type="text/html" id="couponList-template">
<table class="table table-striped table-hover table-bordered">
	<thead>
		<tr>
			<th width="4%">id</th>
			<th width="5%">类型</th>
			<th width="12%">所在服务</th>
			<th width="12%">简介</th>
			<th width="5%">价值</th>
			<th width="10%">编号</th>
			<th width="8%">所属用户</th>
			<th width="5%">状态</th>
			<th width="7%">创建人</th>
			<th width="8%">创建时间</th>
			<th width="8%">过期时间</th>
			<th width="16%">备注</th>
		</tr>
	</thead>
	<tbody >
		<$for(var i = 0;i<result.length;i++){$>
		<tr>
			<td  width="4%">
			<$if(result[i].id != null ) {$>
					<$=result[i].id$>
			<$} else {$>
					<i></i>
			<$}$>
			</td>
			<td class="cou-label" width="5%">
			<$if(result[i].label != null ) {$>
					<$=result[i].label$>
			<$} else {$>
					<i></i>
			<$}$>

			</td>
			<td id = "projectName" class="project-name" width="12%">
			<$if(result[i].project.name != null ) {$>
					<$=result[i].project.name$>
			<$} else {$>
					<i></i>
			<$}$>


			</td>
			<td width="12%">
			<$if(result[i].couponExplain != null ) {$>
					<$=result[i].couponExplain$>
			<$} else {$>
					<i></i>
			<$}$>


			</td>
			<td width="5%">
			<$if(result[i].couponValue != null ) {$>
					<$=result[i].couponValue$>
			<$} else {$>
					<i></i>
			<$}$>


			</td>
			<td width="10%">
			<$if(result[i].couponNo != null ) {$>
					<$=result[i].couponNo$>
			<$} else {$>
					<i></i>
			<$}$>


			</td>
			<td width="8%">
			<$if(result[i].user.name != null ) {$>
					<$=result[i].user.name$>
			<$} else {$>
					<i></i>
			<$}$>


			</td>
			<td class="couponstatus"  width="5%">
			<$if(result[i].couponStatus != null ) {$>
					<$=result[i].couponStatus$>
			<$} else {$>
					<i></i>
			<$}$>


			</td>
			<td width="7%">
			<$if(result[i].created_by.name != null ) {$>
					<$=result[i].created_by.name$>
			<$} else {$>
					<i></i>
			<$}$>


			</td>
			<td class="coupontime" width="8%">
			<$if(result[i].createdDate != null ) {$>
					<$=result[i].createdDate$>
			<$} else {$>
					<i></i>
			<$}$>

	
			</td>
			<td class="coupontime" width="8%">
			<$if(result[i].overdueDate != null ) {$>
					<$=result[i].overdueDate$>
			<$} else {$>
					<i></i>
			<$}$>



			</td>
			<td width="16%">
			<$if(result[i].memo != null ) {$>
					<$=result[i].memo$>
			<$} else {$>
					<i></i>
			<$}$>

			</td>
		</tr>
	<$}$>
	</tbody>
</table>
<$ if ( totalPages > 1 ) { $>
	<div class="pagination">
		<$==pagination$>
	</div>
<$ } $>
</script>



<c:if test="${env == 'production' }">
	<script type="text/javascript">
		seajs.use("${ctx}/assets/js-dist/admin/coupon-list-page");
	</script>
</c:if>
<c:if test="${env != 'production' }">
	<script type="text/javascript">
		seajs.use("${ctx}/assets/js/admin/coupon-list-page");
	</script>
</c:if>